<#assign base=request.contextPath>
<!DOCTYPE html> 
<html>
	<head>
		<title></title>
		<meta charset="utf-8">
		<#include "common/reference.ftl" />
		<#include "common/ligerui.ftl" />
		<script type="text/javascript">
		<!--
			var ligerTable = null;
			$(function(){
				$('.select-chosen').chosen();
				$('.date-picker').datepicker();
				ligerTable = $('#table').ligerGrid({
					width:'98%',
					enabledSort:false,
					pageSizeOptions:[5,10,20,50,100,200],
					height:'auto',
					alternatingRow:true,
					url:'${base}/${route}/getList',
					delayLoad:false,
					columns:[
						{display:'充值ID',name:'recordId',id:'recordId',align:'center',minWidth:30},
						{display:'充值编号',name:'recordNo',id:'recordNo',align:'center',minWidth:150},
						{display:'用户',name:'phoneNo',id:'phoneNo',align:'center',minWidth:150},
						{
							display:'用户类型',
							name:'userType',
							id:'userType',
							align:'center',
							render:function(row){
								var userType = row.userType;
								if((userType & 1) == 1){
									return '用户';
								}
								else if((userType & 2) == 2){
									return '司机';
								}
								else if((userType & 4) == 4){
									return '公司';
								}else if((userType & 8) == 8){
                                    return '分公司';
                                }
								else{
									return '-';
								}
							}
						},
						{display:'充值金额(元)',name:'rechargeMoney',id:'rechargeMoney',align:'center'},
						{display:'充值前金额(元)',name:'beforeBalance',id:'beforeBalance',align:'center'},
						{display:'充值后金额(元)',name:'afterBalance',id:'afterBalance',align:'center'},
						{
							display:'充值来源',
							name:'rechargeFrom',
							id:'rechargeFrom',
							align:'center',
							render:function(row){
								var rechargeFrom = row.rechargeFrom;
								if((rechargeFrom & 1) == 1){
									return '后台';
								}
								else if((rechargeFrom & 2) == 2){
									return '客户端';
								}
								else if((rechargeFrom & 4) == 4){
									return '系统';
								}
								else{
									return '-';
								}
							}
						},
						{
							display:'充值类型',
							name:'rechargeType',
							id:'rechargeType',
							align:'center',
							width:120,
							render:function(row){
								var rechargeType = row.rechargeType;
								if((rechargeType & 1) == 1){
									return '现金充值';
								}
								else if((rechargeType & 2) == 2){
									return '微信充值';
								}
								else if((rechargeType & 4) == 4){
									return '支付宝充值';
								}
								else if((rechargeType & 8) == 8){
									return '余额退款充值';
								}
								else if((rechargeType & 16) == 16){
									return '用户取消行程充值';
								}
								else if((rechargeType & 32) == 32){
									return '完成行程充值';
								}
								else if((rechargeType & 64) == 64){
									return '行程过期退款';
								}
								return '-';
							}
						},
						{
							display:'充值时间',
							name:'rechargeTime',
							id:'rechargeTime',
							align:'center',
							minWidth:150,
							render:function(row){
								var rechargeTime = row.rechargeTime * 1000;
								return formatDate(rechargeTime);
							}
						},
						{display:'操作人',name:'operator',id:'operator',align:'center'},
						{display:'关联单号',name:'linkTaskNo',id:'linkTaskNo',align:'center', minWidth:200}
					]
				});
				
				function reload(){
					if(ligerTable){
						var rechargeFrom = $('#rechargeFrom').val();
						var rechargeType = $('#rechargeType').val();
						var startTime = $('#txtStartTime').val();
						var endTime = $('#txtEndTime').val();
						var searchKey = $('#txtSearchKey').val();
						ligerTable.setParm('rechargeFrom',rechargeFrom);
						ligerTable.setParm('rechargeType',rechargeType);
						ligerTable.setParm('startTime',startTime);
						ligerTable.setParm('endTime',endTime);
						ligerTable.setParm('searchKey',searchKey);
						ligerTable.reload();
					}
				}
				$('#btnSearch').click(function(){
					reload();
				})
			});
		//-->
		</script>
	</head>
	<body class="$configs["skinName"]">
		<#include "common/breadcrumb.ftl">
		<div class="widget-box">
			<div class="widget-header widget-header-flat">
				<h5 class="lighter">
					<i class="fa fa-search"></i>
					${module}查询
				</h5>
			</div>
			<div class="widget-body">
				<div class="widget-main">
					<div class="row">
						<div class="input-daterange input-group col-sm-10">
							<span class="input-group-addon">时间段</span>
							<input class="form-control date-picker" id="txtStartTime" type="text" value="${startTime}" data-date-format="yyyy-mm-dd" />
							<span class="input-group-addon">
								<i class="fa fa-calendar"></i>
							</span>
							<span class="input-group-addon">
								<i class="fa fa-exchange"></i>
							</span>
							<input class="form-control date-picker" id="txtEndTime" type="text" value="${endTime}" data-date-format="yyyy-mm-dd" />
							<span class="input-group-addon">
								<i class="fa fa-calendar"></i>
							</span>
						</div>
					</div>
					<div class="space-4"></div>
					<div class="row">
						<div class="col-sm-2">
							<label>充值来源
								<select id="rechargeFrom">
									<option value="0">全部</option>
									<option value="1">后台</option>
									<option value="2">客户端</option>
								</select>
							</label>
						</div>
						<div class="col-sm-4">
							<label>充值方式
								<select id="rechargeType">
									<option value="0">全部</option>
									<option value="1">现金充值</option>
									<option value="2">微信充值</option>
									<option value="4">支付宝充值</option>
									<option value="8">余额退款充值</option>
									<option value="16">完成行程充值</option>
								</select>
							</label>
						</div>
						<div class="col-sm-4">
							<div class="input-group">
								<span class="input-group-addon">关键字</span>
								<input id="txtSearchKey" type="text" class="form-control search-query" placeholder="请输关键字搜索" />
								<span class="input-group-btn">
									<button id="btnSearch" type="button" class="btn btn-purple btn-sm">
										查询
										<i class="icon-search icon-on-right bigger-110"></i>
									</button>
								</span>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="widget-box">
			<div class="widget-header">
				<h5 class="lighter">
					<i class="icon-table"></i>
					${module}列表
				</h5>
				<!--非查询者有该操作-->
				<#if user?exists && viewerRole?exists && user.roleId != viewerRole>
				<div class="widget-toolbar">
					<button id="btnEdit" type="button" class="btn btn-primary btn-xs">
						<i class="fa fa-check-square-o"></i>编辑
					</button>
					<button id="btnRemove" type="button" class="btn btn-primary btn-xs">
						<i class="fa fa-trash-o"></i>删除
					</button>
				</div>
				</#if>
			</div>
			<div class="widget-body">
				<div id="table"><div>
			</div>
		</div>
	</body>
</html>